package com.task.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.task.bean.Evaluate;
import com.task.service.IEvaluateService;
import com.task.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liuzhe
 * @since 2021-04-10
 */
@RestController
@RequestMapping("/evaluate")
public class EvaluateController {

    @Autowired
    private IEvaluateService evaluateService;

    @PostMapping("/add")
    public ResultVo add(@RequestBody Evaluate evaluate) {
        return ResultVo.success(evaluateService.save(evaluate));
    }

    @GetMapping("/list")
    public ResultVo list(int teaId) {
        return ResultVo.success(evaluateService.queryStuAndEvaByTeaId(teaId));
    }

    @GetMapping("/queryStuEvaluate")
    public ResultVo queryStuEvaluate(int stuId) {
        return ResultVo.success(evaluateService.queryStuEvaluateByStuId(stuId));
    }

    @GetMapping("/queryEvaluate")
    public ResultVo queryEvaluate(int id){
        return ResultVo.success(evaluateService.getEvaAndNameById(id));
    }


}

